import 'package:xinxuan/vo/common_vo/common_pagination_vo.dart';
import 'package:xinxuan/vo/common_vo/common_seckill_order_products_item_vo.dart';
import 'package:xinxuan/vo/common_vo/common_seckill_order_user_vo.dart';

class SeckillOrderListVo {
  
  List<SeckillOrderItem>? data;
  SeckillOrderListMeta? meta;

  SeckillOrderListVo({this.data, this.meta});

  SeckillOrderListVo.fromJson(Map<String, dynamic> json) {
    if (json['data'] != null) {
      data = [];
      json['data'].forEach((v) {
        data!.add(new SeckillOrderItem.fromJson(v));
      });
    }
    meta = json['meta'] != null ? new SeckillOrderListMeta.fromJson(json['meta']) : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.data != null) {
      data['data'] = this.data!.map((v) => v.toJson()).toList();
    }
    if (this.meta != null) {
      data['meta'] = this.meta!.toJson();
    }
    return data;
  }
}

class SeckillOrderItem {
  int? id;
  String? orderSn;
  int? orderType;
  double? commissionRate;
  int? paymentStatus;
  int? buyerId;
  int? sellerId;
  int? teamId;
  int? status;
  String? statusStr;
  int? source;
  String? payAmount;
  String? totalAmount;
  String? createdAt;
  String? updatedAt;
  String? teamName;
  int? recycleStatus;
  CommonSeckillOrderUserVo? user;
  List<CommonSeckillOrderProductsItemVo>? products;

  SeckillOrderItem(
      {this.id,
      this.orderSn,
      this.orderType,
      this.commissionRate,
      this.paymentStatus,
      this.buyerId,
      this.sellerId,
      this.teamId,
      this.status,
      this.statusStr,
      this.source,
      this.payAmount,
      this.totalAmount,
      this.createdAt,
      this.updatedAt,
      this.user,
      this.products,
      this.teamName,
      this.recycleStatus});

  SeckillOrderItem.fromJson(Map<String, dynamic> json) {
    id = json['id'];
    orderSn = json['order_sn'];
    orderType = json['order_type'];
    commissionRate = json['commission_rate'];
    paymentStatus = json['payment_status'];
    buyerId = json['buyer_id'];
    sellerId = json['seller_id'];
    teamId = json['team_id'];
    status = json['status'];
    statusStr = json['status_str'];
    source = json['source'];
    payAmount = json['pay_amount'];
    totalAmount = json['total_amount'];
    createdAt = json['created_at'];
    updatedAt = json['updated_at'];
    teamName = json['team_name'];
    recycleStatus = json['recycle_status'];
    user = json['user'] != null ? new CommonSeckillOrderUserVo.fromJson(json['user']) : null;
    if (json['products'] != null) {
      products = [];
      json['products'].forEach((v) {
        products!.add(new CommonSeckillOrderProductsItemVo.fromJson(v));
      });
    }
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['id'] = this.id;
    data['order_sn'] = this.orderSn;
    data['order_type'] = this.orderType;
    data['commission_rate'] = this.commissionRate;
    data['payment_status'] = this.paymentStatus;
    data['buyer_id'] = this.buyerId;
    data['seller_id'] = this.sellerId;
    data['team_id'] = this.teamId;
    data['status'] = this.status;
    data['status_str'] = this.statusStr;
    data['source'] = this.source;
    data['pay_amount'] = this.payAmount;
    data['total_amount'] = this.totalAmount;
    data['created_at'] = this.createdAt;
    data['updated_at'] = this.updatedAt;
    data['team_name'] = this.teamName;
    data['recycle_status'] = this.recycleStatus;
    if (this.user != null) {
      data['user'] = this.user!.toJson();
    }
    if (this.products != null) {
      data['products'] = this.products!.map((v) => v.toJson()).toList();
    }
    return data;
  }
}


class SeckillOrderListMeta {
  List<Teams>? teams;
  CommonPagination? pagination;

  SeckillOrderListMeta({this.pagination, this.teams});

  SeckillOrderListMeta.fromJson(Map<String, dynamic> json) {
    if (json['teams'] != null) {
      teams = <Teams>[];
      json['teams'].forEach((v) {
        teams!.add(new Teams.fromJson(v));
      });
    }
    pagination = json['pagination'] != null
        ? new CommonPagination.fromJson(json['pagination'])
        : null;
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    if (this.teams != null) {
      data['teams'] = this.teams!.map((v) => v.toJson()).toList();
    }
    if (this.pagination != null) {
      data['pagination'] = this.pagination!.toJson();
    }
    return data;
  }
}

class Teams {
  String? name;
  int? id;

  Teams({this.name, this.id});

  Teams.fromJson(Map<String, dynamic> json) {
    name = json['name'];
    id = json['id'];
  }

  Map<String, dynamic> toJson() {
    final Map<String, dynamic> data = new Map<String, dynamic>();
    data['name'] = this.name;
    data['id'] = this.id;
    return data;
  }
}